package com.woniuxy01;

import java.util.Scanner;

/**
 * @author 作者
 * @create 2025-10-22 14:47
 */
public class Test09 {
    public static void main(String[] args) {
        Scanner scanner=new Scanner(System.in);
        System.out.println("输入运算符+ - * /");
        char operator=scanner.next().charAt(0);
        System.out.println("输入一个运算数");
        int numA=scanner.nextInt();
        System.out.println("输入一个运算数");
        int numB=scanner.nextInt();
        if(operator=='+'){
            System.out.println("本次运算结果："+numA+operator+numB+"="+(numA+numB));
        }else if(operator=='-'){
            System.out.println("本次运算结果："+numA+operator+numB+"="+(numA-numB));
        }else if(operator=='*'){
            System.out.println("本次运算结果："+numA+operator+numB+"="+(numA*numB));
        }else if(operator=='/'){
            if (numB!=0) {
                System.out.println("本次运算结果："+numA+operator+numB+"="+(numA/numB));
            } else {
                System.out.println("除数为0，不能进行除法运算");
            }
        }else{
            System.out.println("无效的运算符，无法计算，必须输入+ - * /");
        }
    }
}
